using UnityEngine;

public class PlayerInLeaderBoard : MonoBehaviour
{
	private const int LENGTH_SUB_NAME = 10;

	[SerializeField]
	private UILabel placeLabel;

	[SerializeField]
	private UILabel loginLabel;

	[SerializeField]
	private UILabel pointLabel;

	[SerializeField]
	private GameObject myBackgroud;

	[SerializeField]
	private GameObject backgroud;

	[SerializeField]
	private GameObject splitter;

	public void Init(LeaderInfo playerInfo)
	{
		placeLabel.text = playerInfo.place.ToString();
		if (playerInfo.nickName.Length > 10)
		{
			loginLabel.text = playerInfo.nickName.Substring(0, 10);
		}
		else
		{
			loginLabel.text = playerInfo.nickName;
		}
		pointLabel.text = playerInfo.stars.ToString();
		if (playerInfo.me)
		{
			myBackgroud.SetActive(true);
		}
		else
		{
			backgroud.SetActive(true);
		}
	}

	public void TurnOnSplitter()
	{
		if ((bool)splitter)
		{
			splitter.SetActive(true);
		}
	}
}
